<template>
    <div class="flex_col card m5 p10">
        <label class="flex_center_self">气缸控制</label>
        <div class="mt5">
            <el-button @click="onClickCtrl(1)">上</el-button>
            <el-button @click="onClickCtrl(2)">下</el-button>
            <el-button @click="onClickCtrl(3)">内</el-button>
            <el-button @click="onClickCtrl(4)">外</el-button>
            <el-button @click="onClickCtrl(0)">关闭</el-button>
            <el-button @click="onClickCtrl(8)">抓取</el-button>
        </div>
        <div class="mt5">
            <el-button @click="onClickCtrl(5)">空压机打开</el-button>
            <el-button @click="onClickCtrl(6)">空压机松开</el-button>
            <el-button @click="onClickCtrl(7)">空压机关闭</el-button>
        </div>

    </div>
</template>

<script lang="ts" setup>
import { comprCtrl } from '@/service/devices/cargo';
import { runAction } from '@/utils/ui';

interface Props {
    index: number,
}

const props = defineProps<Props>();

async function onClickCtrl(position: number) {
    runAction('气缸控制', '', async () => {
        await comprCtrl({
            index: props.index,
            position
        });
    });
}

</script>
